#include <functional>
#include <atomic>
#include <thread>
#include <queue>
#include <mutex>
#include <condition_variable>

class TaskHandler {
public:
    TaskHandler();
    ~TaskHandler();
    void run();
    void stop();
    void addTask(std::function<void()> task);

private:
    std::thread worker_thread_;
    std::queue<std::function<void()>> tasks_queue_;
    std::mutex tasks_queue_mutex_;
    std::condition_variable tasks_queue_cv_;
    std::atomic<bool> is_running_;

}